package unint3_1.packag;

public class c {
}

/**
 * MapTest  测试
 * 相同的key以最后一次的put为准，前面的映射被覆盖了
 */
public class MapTest {
    public static void main(String[] args) {
        HashMap hm = new HashMap();
        System.out.println("刚初始化的时候Map元素数量：" + hm.size());
        hm.put("丁一","王五");
        hm.put("赵二","黄六");
        hm.put("张三","宋琪");
        hm.put("张三","谈八");
        System.out.println("添加了3对元素后Map的数量：" + hm.size());
        String s =(String) hm.get("张三");
        System.out.println(s);
        hm.put("秦四","王五");
        System.out.println("添加了4对元素后Map的数量：" + hm.size());
        String b =(String) hm.get("丁一");
        String a =(String) hm.get("秦四");
        System.out.println(b);
        System.out.println(a);
    }
}
